From 9650bb1b94d1aaf0c9c564a94dfc62331201de08 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 15 Sep 2009 09:08:36 +0100 Subject: [PATCH] PoD: Scrub pages before adding to the cache Neither memory from the allocator nor memory from the balloon driver is guaranteed to be zero. Scrub it before adding to the cache. Signed-off-by: George Dunlap --- xen/arch/x86/mm/p2m.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index cc0653fa7e..15c6b921be 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -307,6 +307,17 @@ p2m_pod_cache_add(struct domain *d, } #endif + /* Pages from domain_alloc and returned by the balloon driver aren't + * guaranteed to be zero; but by reclaiming zero pages, we implicitly promise + * to provide zero pages. So we scrub pages before using */ + for ( i=0; i< 1 << order ; i++) + { + char * b; + b = map_domain_page(page_to_mfn(page) + i); + clear_page(b); + unmap_domain_page(b); + } + spin_lock(&d->page_alloc_lock); /* First, take all pages off the domain list */ -- 2.30.2